<?php
/**
 * Created by PhpStorm.
 * User: wzy12
 * Date: 2018/10/29
 * Time: 0:19
 */

namespace app\common\model;


use think\Model;

class Message extends Model
{
    public function operation($data){
        $data['add_time'] = time();

        $result = $this -> validate(true) -> allowField(true) -> isUpdate(false) -> save($data);
        if(false === $result){
            return echoArr(0, $this -> getError());
        }else{
            return echoArr(1, '提交成功');
        }
    }

    public function del($data){
        $result = $this -> destroy($data);

        if(false === $result){
            return echoArr(0, '删除失败');
        }else{
            return echoArr(1, '删除成功');
        }
    }
}